/*
 * BasicFuncs.java
 * 
 * This file is part of Netuno Psamata.
 * 
 * CajuScript is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3, or (at your option) 
 * any later version.
 * 
 * CajuScript is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with CajuScript.  If not, see <http://www.gnu.org/licenses/>.
*/

package org.netuno.psamata.script;

/**
 * Basic Functions to be used with scripts languages that no supports some resources.
 * @author eduveks
 */
public final class BasicFuncs {
    /**
     * Basic Functions.
     */
    private BasicFuncs() { }
    /**
     * Calculate the Module.
     * @param value Value for extracting module
     * @param div Value of module
     * @return Result
     */
    public static double mod(final double value, final double div) {
        return value % div;
    }
    /**
     * Get Char from a integer.
     * @param asciiCode Ascii Code
     * @return Character
     */
    public static String getChar(final int asciiCode) {
        return "" + (char) asciiCode;
    }
    /**
     * Replace.
     * @param text String for replacing
     * @param textold Deleting this String
     * @param textnew Inserting this String
     * @return String replaced
     */
    public static String replace(final String text, final String textold, final String textnew) {
        return text.replace((CharSequence)textold, (CharSequence)textnew);
    }
}
